package com.example.myapplicationktkt2.ui

import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.Spinner
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.example.myapplicationktkt2.R

class BasicViewsDemoActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_basic_views_demo)

        // 为Spinner添加数据
        val spinner: Spinner = findViewById(R.id.spinner)
        val items = arrayOf("选项1", "选项2", "选项3", "选项4")
        val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, items)
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
        spinner.adapter = adapter
        
        // 启用跑马灯效果
        val singleLineMarquee: TextView = findViewById(R.id.singleLineMarquee)
        val multiLineMarquee: TextView = findViewById(R.id.multiLineMarquee)
        
        // 设置TextView为选中状态以激活跑马灯效果
        singleLineMarquee.isSelected = true
        multiLineMarquee.isSelected = true
    }
}